package com.ybf.api.mapper.provider;

import com.ybf.api.entity.Role;
import org.apache.ibatis.annotations.Param;

public class RoleProvider {
    public StringBuilder findAll(@Param("role") Role role) {
        StringBuilder sql = new StringBuilder("select role_name, intro, status, created_at, updated_at from roles where 1 = 1");
        if(role.getRoleName() != null) {
            sql.append(" and role_name = #{role.role_name}");
        }
        if(role.getStatus() != null) {
            sql.append(" and status = #{role.status}");
        }
        return sql;
    }
}
